/*
 * 创建日期 2009-3-17
 *
 * 成都天和软件公司
 * 电话：028-85425861
 * 传真：028-85425861-8008
 * 邮编：610041 
 * 版权所有
 */
package  org.fantasy.cpp.core.tag;

import java.io.Writer;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.TagSupport;

/**
 * @rem 基本标签
 * @author 王文成
 * @version 1.0
 * @since 2009-3-17
 */
public class AbstractTag extends TagSupport {

	@Override
	public void setPageContext(PageContext pageContext) {
		super.setPageContext(pageContext);
		this.init();
	}
	
	/**
	 * 初始化
	 */
	protected void init() {
	}

	protected String getCtx() {
		return getRequest().getContextPath();
	}

	protected Writer getJspWriter() {
		return pageContext.getOut();
	}

	protected HttpServletRequest getRequest() {
		return (HttpServletRequest) pageContext.getRequest();
	}

	protected HttpServletResponse getResponse() {
		return (HttpServletResponse) pageContext.getResponse();
	}

	protected HttpSession getSession() {
		return (HttpSession) pageContext.getSession();
	}

	protected ServletContext getServletContext() {
		return (ServletContext) pageContext.getServletContext();
	}
}
